/**
 * 
 */
package com.googlecode.xcarve.properties;

import java.util.Properties;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;

/**
 * @author xinyun.du
 *
 */
public class PropertiesUtils {
	
	static Properties properties = null;
	
	public static Object getValue(String key){
		return properties.get(key);
	}
	
	public static String getProperties(String key){
		return properties.getProperty(key);
	}
	
	public static String getProperties(String key,String defaultValue){
		return properties.getProperty(key, defaultValue);
	}
	
	static{
		Resource resource = new ClassPathResource("xcarve.properties");
		try {
			Properties p = PropertiesLoaderUtils.loadProperties(resource);
			properties = p; 
		} catch (Exception e) {
		}
	}
}
